function getCookie(key){
    let cookies = document.cookie.split(";")
    for (var i=0; i<cookies.length; i++) {
        let kv = cookies[i].split("=");
        if(kv[0]===key) {
            return decodeURI(kv[1]);
        }
    }
    return null;
}